package com.my.socket.bio.v6;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.net.InetSocketAddress;
import java.net.Socket;

/**
 * Created by ZhongGang
 * at 2018/6/28 16:44
 */
public class Client {
    private static final Logger LOGGER = LoggerFactory.getLogger(Client.class);

    private String host;
    private int port;
    private Socket socket;

    public Client(String host, int port) throws Exception {
        this.host = host;
        this.port = port;

        this.socket = new Socket();
    }

    public void connect() throws Exception {
        InetSocketAddress inetSocketAddress = new InetSocketAddress(this.host, this.port);
        this.socket.connect(inetSocketAddress);
    }

    public static void main(String[] args) throws Exception {
        for (int i = 0; i < 10000; i++) {
            Client client = new Client("127.0.0.1", 9999);
            client.connect();
        }
    }
}
